]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
panel: Relax check for existing signal handler
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 29 Jun 2019 23:04:32 +0000 (01:04 +0200)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Fri, 12 Jul 2019 18:54:49 +0000 (18:54 +0000)
Object.prototype.hasOwnProperty() is more precise than checking for
falsiness, for instance the following is true:

  { foo: undefined }.hasOwnProperty('foo');

However when checking for a handler ID, a more relaxed check is more
appropriate, as particularly 0 is not a valid handler ID.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/626

js/ui/panel.js

index fcb51950f13edfbdf4bd94af2c285425e3719eaf..6b8e60b1950ce841993039b11d34fa139b3c8f0b 100644 (file)
@@ -1167,7 +1167,7 @@ class Panel extends St.Widget {
     }
 
     _onMenuSet(indicator) {
-        if (!indicator.menu || indicator.menu.hasOwnProperty('_openChangedId'))
+        if (!indicator.menu || indicator.menu._openChangedId)
             return;
 
         indicator.menu._openChangedId = indicator.menu.connect('open-state-changed',